//
//  SEGCardTencentView.m
//  SEGActivity
//
//  Created by 山刘 on 2020/8/5.
//

#import "SEGCardTencentView.h"

@implementation SEGCardTencentView

- (instancetype)init {
    self = [super init];
    if (self) {
        [self seg_addSubView];
    }
    return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self seg_addSubView];
    }
    return self;
}
- (void)seg_addSubView {
    [self addSubview:self.imageView];
    // [self addSubview:self.iconImageView];
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.imageView.frame = self.bounds;
    self.logoView.frame = CGRectMake(CGRectGetWidth(self.frame) - 46,CGRectGetHeight(self.frame) - 14, 46,14);
}

-(UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [[UIImageView alloc]init];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
        //_imageView.image = [UIImage imageNamed:SEGPicName(@"")];
        //_imageView.layer.masksToBounds = YES;
        //_imageView.layer.cornerRadius = 0.5;
        //_imageView.backgroundColor = kSegRandomColor;
    }
    return _imageView;
}

-(UIImageView *)iconImageView {
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc]init];
        _iconImageView.contentMode = UIViewContentModeScaleAspectFill;
        //_iconImageView.image = [UIImage imageNamed:SEGPicName(@"")];
        //_iconImageView.layer.masksToBounds = YES;
        //_iconImageView.layer.cornerRadius = 0.5;
        //_iconImageView.backgroundColor = kSegRandomColor;
    }
    return _iconImageView;
}

-(void)updateData:(GDTUnifiedNativeAdDataObject*)data {
    UIImage *placeholderImage = [UIImage imageNamed:SEGPicName(@"pic_default_70_70")];
    [self.imageView setImageWithURL:[NSURL URLWithString:data.imageUrl] placeholderImage:placeholderImage];
    // [self.iconImageView setImageWithURL:[NSURL URLWithString:data.iconUrl]];
}
@end
